<var_oper> : Modify Variable Value

Performs selected operation on input variable (or constant string/value) and saves the result to other variable.

Syntax:

<var_oper>(ResultVar, "Input", Operation, Param1, Param2, Param3)

ResultVar
Variable that receives result of the operation.

Input
Either variable or constant text (string, numerical value) to perform operation on.

Operation
One of these operations:

CALC_EXPRESSION
- calculates arithmetical expression defined by input. Param1 tells how many numbers will follow after decimal point.

RANDOM_NUMBER
- generates random number from 0 to Param1 range.

SELECT_FILE
- shows ôOpen Fileö dialog and saves full path of the selected file to ResultVar
If user clicks "Cancel" button the _vCanceled system variable is set to 1 (otherwise it is 0) to allow macro designer to distinguish between situations when OK or Cancel button was clicked.

SELECT_FOLDER
- shows ôSelect Folderö dialog and saves full path of the selected folder to ResultVar
If user clicks "Cancel" button the _vCanceled system variable is set to 1 (otherwise it is 0) to allow macro designer to distinguish between situations when OK or Cancel button was clicked.

GET_TEXT_FROM_CLIPBOARD
- copies text from clipboard to ResultVar.

STR_APPEND
- appends the Input to the content of ResultVar.

STR_LEFT
- characters from begin of the Input (number of characters is given by Param1) are copied to ResultVar.

STR_RIGHT
- characters from end of the Input (number of characters is given by Param1) are copied to ResultVar.

STR_MID
- characters beginning at Param1 position (number of characters is given by Param2) are copied to ResultVar.

STR_TRIMLEFT

- characters specified in Param1 are deleted from begin of the Input.
STR_TRIMRIGHT
- characters specified in Param1 are deleted from end of the Input.

STR_INSERT
- string defined by Param2 is inserted to Input string to position Param1.

STR_REPLACE
- In the Input, original string Param1 is replaced by Param2.

STR_DELETE
- in the Input, deletes Param2 (number of characters to delete) characters starting at position Param1.

STR_FIND
- finds first occurrence of the Param1 string in the Input.  The search is started from Param2 position.

STR_UPPER
- converts Input to upper case.

STR_LOWER
- converts Input to lower case.

STR_LENGTH
- returns length of the Input.

STR_GET_CHAR
- returns character from the Param1 position in the Input.

STR_TOGGLE_CASE
- changes upper case to lower case and vice versa.

STR_SENTENCE_CASE
- changes first character on begin of each sentence to upper case.

STR_INTERSPACES
- extra space is added to next to each Input character.  Example: ôABCö is changed to ôA B C ô.

STR_FIRST_UPPER
- changes first character of Input to upper case.

TEXT_GET_WORD
- retrieves a word from Param1 position within Input Param2 contains characters user can exclude from default word delimiters ( ;,\t\n\r?!.:).  This means that if "." is excluded from the delimiters then "www.my7thsite.com" is returned as a single word.  Otherwise it is returned as three words.

TEXT_GET_NUMOFWORDS
- return number of words in InputParam2 contains characters user can exclude from default word delimiters ( ;,\t\n\r?!.:).

TEXT_GET_LINE
- retrieves line number Param1 (line numbers start at 0) from Input.

TEXT_GET_NUMOFLINES
- returns number of lines in Input.

TEXT_JUSTIFY
- justifies the Input text so that all lines have the same length defined by Param1.  If the Param1 is û1 the length of all lines is the same as the first line.

TEXT_INDENT_LEFT
- removes leading spaces on begin of each Input line.

TEXT_INDENT_RIGHT
- adds extra spaces on begin of each Input line.

TEXT_ADDNUMBERING
- justifies and adds numbering to paragraphs of Input text.  Paragraphs are delimited by empty line.  Param1 defines width of the justified text.  If the Param1 is û1 the length of all lines is the same as the first line.  Param2 defines numbering style.  It can be one of the follows: 
"1)", "1.", "1/", "A)", "A.", "A/", "a)", "a.", "a/", "-", "#", "*"
TEXT_CENTER
- centers Input text.  Param1 defines width of the text.

TEXT_UNDERLINE_LIKE
- extra line consisting of ô-ô characters is added to Input.

TEXT_ALIGN_LEFT
- aligns Input text left by removing spaces on begin of each line.

TEXT_ALIGN_RIGHT
- aligns Input text to right by adding extra spaces on begin of each line.  Param1 defines width of the text.  If the Param1 is û1 the width is given by the width of the first line.

ARRAY_SORT_STRING
- sorts ResultVar array (array variable) of strings.  If Param1 is 1 then sorting is case sensitive.   Param2 (if specified) is delimiter that delimits the input string so that only the part before delimiter is taken for the comparison.  Example: If variable string is "Smooth, John, john@e-mail.net" and delimiter is "," only the "Smooth" is used for comparison.  If no delimiter is defined whole "Smooth, John, john@e-mail.net" string is used for comparison.

ARRAY_SORT_NUM
- sorts ResultVar array (array variable) of numbers.  The Param2 meaning is the same as in ARRAY_SORT_STRING above.

ARRAY_DELETEALLITEMS
- deletes all items of the ResultVar array (array variable).  

ARRAY_DELETEITEM
- removes specific item from the ResultVar array (array variable).   Param1 is an index of the item to remove. 

ARRAY_INSERTITEM
- inserts item to defined position in the ResultVar array (array variable).   Param1 is new item position and Input is value of the newly inserted item.

ARRAY_FINDITEM
- searches for the specified value (text) in Param2 array (array variable).   Param1 is an index to start searching from.  Input is the text to search for.  If an array item matches search criteria then the item index is saved to ResultVar variable.  The search only succeeds if whole the item value is equal to Input value (matching is case sensitivity).

ARRAY_FINDITEM_NOCASE
- searches for the specified value (text) in Param2 array (array variable).   Param1 is an index to start searching from.  Input is the text to search for.  If an array item matches search criteria then the item index is saved to ResultVar variable.  The search only succeeds if whole the item value is equal to Input value - but matching is not case sensitive.

ARRAY_FINDITEM_PARTIALMATCH
- searches for the specified value (text) in Param2 array (array variable).   Param1 is an index to start searching from.  Input is the text to search for.  If an array item matches search criteria then the item index is saved to ResultVar variable.  The search succeeds if the item value contains Input value (matching is case sensitivity).  For example, an array item "jim@InterCTX.com" matches "CTX" Input value.

ARRAY_FINDITEM_PARTIALMATCH_NOCASE
- searches for the specified value (text) in Param2 array (array variable).   Param1 is an index to start searching from.  Input is the text to search for.  If an array item matches search criteria then the item index is saved to ResultVar variable.  The search succeeds if the item value contains Input value - but matching is not case sensitive.  For example, an array item "jim@InterCTX.com" matches "interctx" Input value.

ARRAY_SIZE
- returns the highest index with variable set.

IS_VAR_DEFINED
- returns 1 if the variable specified in Param2 is already defined.  Otherwise it returns 0.

Param1
Parameter that depends on operation.

Param2
Parameter that depends on operation.

Param3
Parameter that depends on operation.
 

Example:

<#> This example converts text in clipboard to upper-case
<#>
<cmds>
<var_oper>(vClipboardText,"",GET_TEXT_FROM_CLIPBOARD,"","", "0")
<if_str>("vClipboardText!=_vStrEmpty")

   <var_oper>(vClipboardText,"%vClipboardText%",STR_UPPER,"","", "0")
   <clpput>("vClipboardText")
   <msg>(-100,-100,"Text in clipboard is converted to uppercase.","Message",1)

<endif>